print the elements of a linked list